﻿using HMEngine.HMComponents;
using Microsoft.Xna.Framework;

namespace HMEngine.HMEffects {
    public sealed class HMEffectManager : DrawableGameComponent {
        internal HMEffectManager(Game game) : base(game) { }

        public static HMEffect ActiveShader { get; private set; }

        public static void AddEffect(string effectLabel, HMEffect newEffect) { HMComponentManager.AddComponent(effectLabel, newEffect); }

        internal static void SetActiveShader(string effectLabel) {
            ActiveShader = null == effectLabel
                               ? HMComponentManager.GetComponent<HMShader>("HMEngine.HMEffects.BasicShader")
                               : HMComponentManager.GetComponent<HMShader>(effectLabel);
        }

        public override void Initialize() {
            var basicShader = new HMShader("HMEngineContent/Shaders/BasicShader");
            AddEffect("HMEngine.HMEffects.BasicShader", basicShader);

            base.Initialize();
        }
    }
}